package org.example.server.config;

import org.example.server.interceptor.interCepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class interceptorconfig implements WebMvcConfigurer {
    @Autowired
    private interCepter interceptor;
    //这里拦截器用注入的，之前是直接new一个interCepter,但是这样会导致JwtProperties没有注入，所以这里用注入的
    //就是这里用注入会导致interCepter里面的JwtProperties不能注入
    //用注入就都用注入
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(interceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/register/**")
                .excludePathPatterns("/envContent/**");

    }
}
